package demo03;
//所有的类都定义在这个包里面
//图形抽象类
public abstract class Shape {
	 public abstract double calculateArea();

}
//圆形类
class Circle extends Shape {
    private double radius;

    public Circle(double radius) {
        this.radius = radius;
    }

    @Override
    public double calculateArea() {
        return 3.14 * radius * radius; // 使用π=3.14保证输出一致
    }
}
//矩形类
class Rectangle extends Shape {
    private double length;
    private double width;

    public Rectangle(double length, double width) {
        this.length = length;
        this.width = width;
    }

    @Override
    public double calculateArea() {
        return length * width;
    }
}